aks-preview: Support VMSS agent pool VM size resize via nodepool update#9732
aks-preview: Support VMSS agent pool VM size resize via nodepool update#9732wenhug wants to merge 6 commits intoAzure:mainfrom
Conversation
️✔️Azure CLI Extensions Breaking Change Test
|
|
Hi @wenhug, |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
|
Hi @wenhug Release SuggestionsModule: aks-preview
Notes
|
There was a problem hiding this comment.
Pull request overview
This PR extends az aks nodepool update --node-vm-size to support resizing VMSS-based agent pools (preview), aligning CLI behavior with the RP’s rolling-replacement resize flow.
Changes:
- Add a VMSS-aware
update_vm_size()path to the nodepool update decorator and wire it intoupdate_agentpool_profile_preview(). - Mark
--node-vm-sizeas a preview parameter foraks nodepool updateand update CLI help text/examples accordingly. - Add unit tests validating
update_vm_size()behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/aks-preview/azext_aks_preview/agentpool_decorator.py |
Adds update_vm_size() and invokes it during preview nodepool update assembly. |
src/aks-preview/azext_aks_preview/_params.py |
Marks --node-vm-size as preview for aks nodepool update. |
src/aks-preview/azext_aks_preview/_help.py |
Updates help text and adds a VMSS resize example. |
src/aks-preview/azext_aks_preview/tests/latest/test_agentpool_decorator.py |
Adds unit tests for update_vm_size(). |
|
Addressed the two Copilot review comments: Comment 1 (blocker in Comment 2 (VMs pool test): Added a third test case verifying Also added a |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Please resolve merge conflict and rebase/merge from main to pass the CI checks, @wenhug |
2f7b0ad to
e51f6fa
Compare
|
@FumingZhang @yonzhan ,addressed conflicts |
|
Please resolve the merge conflict and run a successful live test in any region or environment you find suitable for testing @wenhug |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
@FumingZhang resolved |
|
@yonzhan , could you help review this PR? Thanks! |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Enable changing the VM size (SKU) of an existing VMSS-based agent pool via `az aks nodepool update --node-vm-size <new-size>`. The RP performs a rolling upgrade (surge new nodes, drain old, delete old) to replace nodes with the new VM size. This preview feature requires: - AFEC registration: Microsoft.ContainerService/AgentPoolVMSSResize - RP internal toggle: enable-agentpool-vmsize-resize Changes: - agentpool_decorator.py: add update_vm_size() for VMSS pools and call it in update_agentpool_profile_preview() - _params.py: mark --node-vm-size as is_preview for nodepool update - _help.py: update help text and add VMSS resize example - test_agentpool_decorator.py: add unit tests for update_vm_size
Address review comments: 1. Remove the InvalidArgumentValueError in update_auto_scaler_properties() that blocked --node-vm-size for VMSS pools. This check was added when --node-vm-size only supported VirtualMachines pools, but now VMSS pools support VM size resize via rolling upgrade. 2. Add test case for VirtualMachines pool to verify update_vm_size() is a no-op (VMs pools handle VM size via the autoscaler update path). 3. Add HISTORY.rst entry for the new feature.
Add a live scenario test that creates a cluster with Standard_D2s_v3 and resizes the nodepool to Standard_D4s_v3 via `az aks nodepool update --node-vm-size`, verifying the rolling upgrade completes successfully. Addresses reviewer request for scenario test coverage with custom header bypass for the AgentPoolVMSSResize feature flag. Signed-off-by: wenhug <50309350+wenhug@users.noreply.github.com>
The test_update_agentpool_profile_preview tests mock all update methods called by update_agentpool_profile_preview(). Adding update_vm_size() to the call chain requires updating these mocks and assertions. Signed-off-by: wenhug <50309350+wenhug@users.noreply.github.com>
The scenario test requires real Azure credentials and cannot run in CI's recording/playback mode. Add @live_only() decorator to skip it in CI while still allowing manual live test runs. Signed-off-by: wenhug <50309350+wenhug@users.noreply.github.com>
The RP now gates VMSize resize by preview API version instead of AFEC feature registration, so the AKSHTTPCustomFeatures header is no longer needed. Signed-off-by: wenhug <50309350+wenhug@users.noreply.github.com>
d44ea4e to
f1c16dd
Compare
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
/azp run |
|
Commenter does not have sufficient privileges for PR 9732 in repo Azure/azure-cli-extensions |
Summary
Enable changing the VM size (SKU) of an existing VMSS-based agent pool via
az aks nodepool update --node-vm-size <new-size>.When the user changes the VM size of a VMSS node pool, the AKS RP performs a rolling upgrade:
This is a preview feature that requires:
Microsoft.ContainerService/AgentPoolVMSSResizeenable-agentpool-vmsize-resize(currently enabled for E2E + Canary)The
--node-vm-sizeparameter already existed onnodepool updatefor VirtualMachines pool autoscaler updates. This PR extends it to also work for VMSS pools.Usage
# Resize VM size for a VMSS node pool az aks nodepool update \ -g MyResourceGroup \ -n nodepool1 \ --cluster-name MyManagedCluster \ --node-vm-size Standard_D4s_v3RP-side validation
The RP validates the resize request and blocks incompatible combinations:
Changes
update_vm_size()method for VMSS pools and integrate it intoupdate_agentpool_profile_preview()--node-vm-sizeasis_preview=Truefornodepool updateupdate_vm_sizeTest plan
update_vm_size(both Standalone and ManagedCluster modes)Scenario_VMSS_VMSize_Resize)